//
//  UIView+HDMakeSureView.m
//  app
//
//  Created by D on 15/8/31.
//  Copyright (c) 2015年 hdaren. All rights reserved.
//

#import "HDMakeSureView.h"

static const CGFloat kMargin = 12.0f;

static const CGFloat kMakeSureW = 84.0f;
static const CGFloat kMakeSureH = 44.0f;

@implementation HDMakeSureView

-(id)initWithModel:(HDRepairListModle *)model
{
    if (self  = [super init]) {
        
        self.frame = CGRectMake(0, 0, UBO_WINDOW.width, 64);
        self.backgroundColor = [UIColor clearColor];
        
        UIButton * makeSure = [[UIButton alloc]initWithFrame:CGRectOf([self.ubo fx:1 ox:-kMakeSureW-kMargin fy:UB_1_2 oy:-kMakeSureH/2], [self.ubo ow:kMakeSureW oh:kMakeSureH])];
        makeSure.backgroundColor = [UIColor colorWithRed:238.0/255.0 green:53.0/255.0 blue:65.0/255.0 alpha:1.0];
        [makeSure setTitle:@"确认完成" forState:UIControlStateNormal];
        [makeSure setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        [makeSure addTarget:self action:@selector(makeSure:) forControlEvents:UIControlEventTouchUpInside];
        [makeSure.titleLabel setFont:[UIFont systemFontOfSize:16]];
        [self addSubview:makeSure];
        
        if ([model.status isEqualToString:@"完成"])  {
            makeSure.hidden = YES;
            
        }else
        {
            makeSure.hidden = NO;
        }

        
    }
    return self;
}
-(void)makeSure:(UIButton*)sender
{
    if (self.delegate && [self.delegate respondsToSelector:@selector(makeSureCodeFinish)]) {
        [self.delegate makeSureCodeFinish];
    }
}


@end
